package page2;

import java.util.Scanner;

public class Ques1839 {
	
	public void go(){
		Scanner scan = new Scanner(System.in);
		outter:while(scan.hasNext()){
			String s1 = scan.next();
			String s2 = scan.next();
			if(s1.length() != s2.length()){
				System.out.println(1);
				continue outter;
			}
			if(s1.equals(s2)){
				System.out.println(2);
				continue outter;
			}
			if(s1.toLowerCase().equals(s2.toLowerCase())){
				System.out.println(3);
				continue outter;
			}
			if(s1.length() == s2.length()){
				System.out.println(4);
				continue outter;
			}
		}
	}
	
	public static void main(String[] args) {
		new Ques1839().go();
	}
}
